package cn.edu.gxu.xingjian.teacherassistant.domain;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaActiveRecord
public class Teacher {

    @NotNull
    @Size(min = 2)
    private String name;

    @NotNull
    @Size(min = 2)
    private String age;

    @NotNull
    @Size(min = 4)
    private String workingNumber;

    @NotNull
    @Size(min = 1, max = 1)
    private String sex;

    @NotNull
    @Size(min = 2)
    private String department;

    @NotNull
    @Size(min = 2)
    private String titles;

    @ManyToOne
    private AccountPassword accountPassword;

    @ManyToOne
    private PatternRole patternRole;

    @ManyToOne
    private College college;

    @ManyToMany(cascade = CascadeType.ALL)
    private Set<EducationTask> educationTasks = new HashSet<EducationTask>();
}
